package com.itheima.api.hashset.demo04;

import java.util.HashSet;
import java.util.Random;

public class HashDemo04 {

    public static void main(String[] args) {

        HashSet<Integer> hashSet = new HashSet<>();

        while (hashSet.size() < 10) {

            Random random = new Random();
            int i = random.nextInt(20) + 1;

            hashSet.add(i);
        }

        hashSet.forEach( s -> System.out.println(s));
    }
}
